<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ page import="com.request.DBUtils"%>
<%@ page import="com.request.Request"%>
<%@ page import="com.request.PMF"%>
<%@ page import="javax.jdo.PersistenceManager"%>
<%@ page import="javax.jdo.Query"%>
<html>
<body>
	<%
		String k = request.getParameter("id");
		Long id = Long.valueOf(k);
		String name = request.getParameter("name");
		String university = request.getParameter("university");
		String email = request.getParameter("email");
		String comment = request.getParameter("feedback");

		if (comment == "" || comment == "NA")
			comment = "NA";

		Request r = DBUtils.retrieve(id);

		PersistenceManager pm = PMF.get().getPersistenceManager();
		try {
			Request s = pm.getObjectById(Request.class, r.getKey());
			s.setName(name);
			s.setUniversity(university);
			s.setEmail(email);
			s.setComment(comment);
		} catch (Exception ex) {
			response.sendRedirect("error.html");
		} finally {
			pm.close();
		}

		response.sendRedirect("admin.jsp");
	%>

</body>
</html>